package com.swjd.controller;

import com.swjd.pojo.Type;
import com.swjd.service.impl.TypeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


@Controller
@RequestMapping(value = "action/", method = RequestMethod.POST)
public class TypeController {
    @Autowired
    private TypeServiceImpl typeService;

    @ResponseBody
    @RequestMapping("selectAllTypeOne")//查询所有类型(一对多)
    public List<Type> selectAllOne(@RequestParam(value = "tName", required = false) String tName) {
        return typeService.selectAllOne(tName);
    }

    @ResponseBody
    @RequestMapping("selectAllTypeDuo")//查询所有类型(多对一)
    public List<Type> selectAllDuo(@RequestParam(value = "tName", required = false) String tName) {
        return typeService.selectAllDuo(tName);
    }
}
